August 31, 2015

Spatial environmental data analysis with R

  • Course: Mondays 3-5pm 144 Wilkeson Quad
  • Office Hours: Mondays 3-5pm, 120 Wilkeson Quad

The R Project for Statistical Computing

  • Open source
  • Data manipulation
  • Data analysis tools
  • Great graphics
  • Programming language
  • 6,000+ free, community-contributed packages
  • A supportive and increasing user community

R is a dialect of the S language and environment developed at Bell Laboratories (formerly AT&T) by John Chambers and colleagues (the same group that developed C and UNIX©)

Why use the R environment?

  • an effective data handling and storage facility
  • a suite of operators for (vectorized) calculations
  • a large, coherent, integrated collection of tools for data analysis
  • graphical capabilities (screen or hardcopy)
  • a well-developed, simple, and effective programming language which includes
    • conditionals
    • loops
    • user defined functions
    • input and output facilities

R Packages

Other Resources

Drawing

Reproducible, Portable, & Transparent

Figures in R

Spatial Analysis & Visualization

Packages: sp, maptools, rgeos, raster, ggmap

Example: species range overlays source

Spatial Analysis & Visualization

Example: Visualizing Data with basemaps with ggmap source

Spatial Analysis & Visualization

Parallel Processing

For BIG jobs:

multi-core processors / high performance computing

Drawing

Strengths & Limitations

  • Just-in-time compilation:
    • Slower than compiled languages (-)
    • Faster to compose and develop (+)
  • Many available packages (+)
  • Most operations conducted in RAM
    • RAM can be limiting and/or expensive (-)
    • “Error: cannot allocate vector of size X Mb”
    • Various packages and clever programming can overcome this… (+)
  • Free like beer and speech! (+)

R Interface

Drawing

But there are other options…

R Interface

Mac

Drawing

R Interface

Windows

Drawing

R Interface

RStudio

Drawing

Mac, Windows, Linux, and over the web (via RStudio Server)

Workflow

Drawing

Adapted from Gandrud (2014) Reproducible Research with R and RStudio.